<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>Salida de Insumo <?php echo $insumo['Insumo']['nombre'] ?></h3>
</div>
<?php //debug($ultimoMovimiento); ?>
<?php echo $this->Form->create('Movimiento'); ?>
<div class="modal-body">
    <?php $id = $insumo['Insumo']['id']; ?>
    <?php echo $this->Form->hidden('insumo_id', array('value' => $id)); ?>
    <?php echo $this->Form->hidden('ingreso', array('value' => 0)); ?>
    <fieldset>
        <legend>Insumo: <small><?php echo $insumo['Insumo']['nombre']; ?></small></legend>
        <label for="formA04">Unidades a sacar:</label>                            
        <?php echo $this->Form->text('salida', array('id' => 'formA04', 'class' => 'span3', 'placeholder' => 'Ingrese cantidad numeral Ej: 12', 'required', 'title' => 'Este campo Necesario')); ?>
        <!-- form item -->

        <label for="accountAddressState" class="control-label">Lugar <span class="required">*</span></label>
        <div class="controls">
            <select id="combo" class="span3" name="data[Movimiento][lugare_id]" required>
                <option value="" selected="selected">Selecione el lugar de donde sacar</option>
                <?php foreach ($dcl as $dl): ?>                                    
                    <option value="<?php echo $dl['Lugare']['id']; ?>"><?php echo $dl['Lugare']['nombre']; ?></option>
                <?php endforeach; ?>
            </select>
        </div>
        <!-- form item -->

        <div id="muestra">
            <label>Cantidad de este insumo en almacen: </label>
            &nbsp;&nbsp;0
        </div>
        <!-- // form item -->

        <label for="accountAddressState" class="control-label">Lugar <span class="required">*</span></label>
        <div class="controls">
            <select id="combo" class="span3" name="data[Movimiento][tiposalidas_id]" required>
                <option value="" selected="selected">Selecione el motivo</option>
                <?php foreach ($dcSalidas as $dcs): ?>                                    
                    <option value="<?php echo $dcs['Tiposalida']['id']; ?>"><?php echo h($dcs['Tiposalida']['nombre']); ?></option>
                <?php endforeach; ?>
            </select>
        </div>
        <!-- form item -->
        
        <label for="formA05">Observaciones</label>
        <?php echo $this->Form->textarea('observaciones') ?>
    </fieldset>	
</div>

<div class="modal-footer">
    <button type="button" data-dismiss="modal" class="btn btn-boo">Cerrar</button>
    <button type="submit" class="btn btn-blue">Ok</button>
</form>
</div>                        
<script>
    $('#combo').change(function(){
        $('#muestra').load('movimientos/ajaxcantidad/'+<?php echo $id ?>+'/'+this.value);
    });
</script>